{"componentChunkName":"component---node-modules-rocketseat-gatsby-theme-docs-core-src-templates-docs-query-js","path":"/manual-review/CowswapOrderSigner-COS","result":{"data":{"mdx":{"id":"034f0ee6-7cb8-522d-b5c1-96d7fa51ed03","excerpt":"COS-01M: Inexistent Exposure of Inverse Operation Type Severity Location Logical Fault CowswapOrderSigner.sol:L50 Description: The  CowswapOrderSigner  contract…","fields":{"slug":"/manual-review/CowswapOrderSigner-COS/"},"frontmatter":{"title":"CowswapOrderSigner Manual Review Findings","description":"Contains all the findings that relate to manual review on the contract codebase","image":null,"disableTableOfContents":null},"body":"var _excluded = [\"components\"];\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsxRuntime classic */\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"title\": \"CowswapOrderSigner Manual Review Findings\",\n  \"description\": \"Contains all the findings that relate to manual review on the contract codebase\"\n};\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, _excluded);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"h2\", {\n    \"id\": \"span-idcos-01mcos-01m-inexistent-exposure-of-inverse-operationspan\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#span-idcos-01mcos-01m-inexistent-exposure-of-inverse-operationspan\",\n    \"aria-label\": \"span idcos 01mcos 01m inexistent exposure of inverse operationspan permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), mdx(\"span\", {\n    id: \"COS-01M\"\n  }, \"COS-01M: Inexistent Exposure of Inverse Operation\")), mdx(\"table\", null, mdx(\"thead\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"thead\"\n  }, mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Type\"), mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Severity\"), mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Location\"))), mdx(\"tbody\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"a\", {\n    parentName: \"td\",\n    \"href\": \"/reports/gnosis-guild-cow-order-signer-654ca7b04ca7a30019c86b95/appendix/finding-types#logical-fault\"\n  }, \"Logical Fault\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"img\", {\n    parentName: \"td\",\n    \"className\": \"o-severity o-minor\",\n    \"src\": \"https://omniscia.io/report-assets/minor.png\"\n  })), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"a\", {\n    parentName: \"td\",\n    \"href\": \"https://github.com/gnosis/cow-order-signer/blob/83d1ffe1abdf186e824400a3caa0b7733065742f/contracts/CowswapOrderSigner.sol#L50\"\n  }, \"CowswapOrderSigner.sol:L50\"))))), mdx(\"h3\", {\n    \"id\": \"description\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#description\",\n    \"aria-label\": \"description permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Description:\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"CowswapOrderSigner\"), \" contract exposes a \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://github.com/gnosis/cow-order-signer/blob/83d1ffe1abdf186e824400a3caa0b7733065742f/contracts/CowswapOrderSigner.sol#L25-L51\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"a\"\n  }, \"CowswapOrderSigner::signOrder\")), \" function to register a pre-signed order in the Cowswap system, however, no method exists to reverse this operation via the \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://github.com/gnosis/cow-order-signer/blob/83d1ffe1abdf186e824400a3caa0b7733065742f/contracts/cowProtocol/mixins/GPv2Signing.sol#L88-L97\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"a\"\n  }, \"GPv2Signing::setPreSignature\")), \" function with a \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"false\"), \" argument.\"), mdx(\"h3\", {\n    \"id\": \"impact\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#impact\",\n    \"aria-label\": \"impact permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Impact:\"), mdx(\"p\", null, \"While the recommendation to include this feature to the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"CowswapOrderSigner\"), \" is valid, it was still possible to directly interact with the CowSwap system to disable a particular pre-signature. As such, we consider this exhibit to be of \\\"minor\\\" severity.\"), mdx(\"h3\", {\n    \"id\": \"example\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#example\",\n    \"aria-label\": \"example permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Example:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-sol\",\n    \"metastring\": \"title=contracts/CowswapOrderSigner.sol highlight={39} lineNumbers=true lineOffset=11\",\n    \"title\": \"contracts/CowswapOrderSigner.sol\",\n    \"highlight\": \"{39}\",\n    \"lineNumbers\": \"true\",\n    \"lineOffset\": \"11\"\n  }, \"contract CowswapOrderSigner {\\n    using GPv2Order for GPv2Order.Data;\\n\\n    GPv2Signing public immutable signing;\\n    bytes32 immutable domainSeparator;\\n    address immutable deployedAt;\\n\\n    constructor(GPv2Signing _signing) {\\n        signing = _signing;\\n        domainSeparator = _signing.domainSeparator();\\n        deployedAt = address(this);\\n    }\\n\\n    function signOrder(\\n        GPv2Order.Data calldata order,\\n        uint32 validDuration, // seconds\\n        uint256 feeAmountBP // basis points\\n    ) external {\\n        require(address(this) != deployedAt, \\\"DELEGATECALL only\\\");\\n        require(\\n            block.timestamp + validDuration > order.validTo,\\n            \\\"Dishonest valid duration\\\"\\n        );\\n        require(\\n            order.feeAmount <= (order.sellAmount * feeAmountBP) / 10000 + 1,\\n            \\\"Fee too high\\\"\\n        );\\n\\n        // compute order UID\\n        bytes32 orderDigest = order.hash(domainSeparator);\\n        bytes memory orderUid = new bytes(GPv2Order.UID_LENGTH);\\n        GPv2Order.packOrderUidParams(\\n            orderUid,\\n            orderDigest,\\n            address(this),\\n            order.validTo\\n        );\\n\\n        signing.setPreSignature(orderUid, true);\\n    }\\n}\\n\")), mdx(\"h3\", {\n    \"id\": \"recommendation\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#recommendation\",\n    \"aria-label\": \"recommendation permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Recommendation:\"), mdx(\"p\", null, \"We advise such functionality to be introduced, preferably with no \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"require\"), \" checks in relation to the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"validTo\"), \" and \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"feeAmount\"), \" members, ensuring that the logic of the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"CowswapOrderSigner\"), \" which can be executed via \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"delegatecall\"), \" operations enables the de-authorization of pre-signed Cowswap orders.\"), mdx(\"h3\", {\n    \"id\": \"alleviation-da3062f6b3ff452092a0b6daa6f226f0f3b696c6\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#alleviation-da3062f6b3ff452092a0b6daa6f226f0f3b696c6\",\n    \"aria-label\": \"alleviation da3062f6b3ff452092a0b6daa6f226f0f3b696c6 permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Alleviation (da3062f6b3ff452092a0b6daa6f226f0f3b696c6):\"), mdx(\"p\", null, \"A new method was introduced labelled as \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"CowswapOrderSigner::unsignOrder\"), \" that permits the pre-signature of an order to be set to \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"false\"), \", alleviating this exhibit in full.\"), mdx(ViewDiffButton, {\n    repoUrl: \"https://github.com/gnosis/cow-order-signer\",\n    mainHash: \"83d1ffe1abdf186e824400a3caa0b7733065742f\",\n    fixHash: \"da3062f6b3ff452092a0b6daa6f226f0f3b696c6\",\n    gitHubIssue: \"0\",\n    mdxType: \"ViewDiffButton\"\n  }));\n}\n;\nMDXContent.isMDXComponent = true;","headings":[{"depth":2,"value":"<span id=\"COS-01M\">COS-01M: Inexistent Exposure of Inverse Operation</span>"},{"depth":3,"value":"Description:"},{"depth":3,"value":"Impact:"},{"depth":3,"value":"Example:"},{"depth":3,"value":"Recommendation:"},{"depth":3,"value":"Alleviation (da3062f6b3ff452092a0b6daa6f226f0f3b696c6):"}]}},"pageContext":{"slug":"/manual-review/CowswapOrderSigner-COS/","prev":{"label":"CowswapOrderSigner.sol (COS-S)","link":"/static-analysis/CowswapOrderSigner-COS"},"next":{"label":"GPv2Signing.sol (GPS-M)","link":"/manual-review/GPv2Signing-GPS"}}},"staticQueryHashes":["1954253342","2328931024","2501019404","973074209"]}